#include <functional>
#include <vector>
#include <map>
#include <boost\tokenizer.hpp>
#include <tuple>

#include "wingbox.h"

class exec {
public:
	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
	typedef std::vector<std::string> arglist;
	typedef std::function<void(wingbox&, const arglist& )> functor;
	typedef std::tuple<functor, std::string> functiondata;
	typedef std::map<std::string, functiondata> functionmap;
	typedef functionmap::iterator functionmap_iter;
	typedef functionmap::const_iterator functionmap_const_iter;


	exec(wingbox* box);


	void RegisterFunc(const std::string& name, const functor& function, const std::string& help = "");


	bool perform(const std::string& input) const;
	void displayHelp() const;

	functionmap_const_iter getFunction(const std::string& funcname) const;


private:
	
	functor no_oper;
	wingbox* design;

	functionmap allfunctions;

};